package com.anmai.crawler1.dao;

import com.anmai.crawler1.entity.ShopBean;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface ShopDao {
    int deleteByPrimaryKey(Integer id);

    int insert(ShopBean record);

    int insertSelective(ShopBean record);

    ShopBean selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(ShopBean record);

    int updateByPrimaryKey(ShopBean record);

    //判断是否存在
    @Select("select count(id) from shop where title = #{title,jdbcType=VARCHAR} and poi_id = #{poiId,jdbcType=INTEGER}")
    Integer isExist(ShopBean shopBean);

    @Select("select * from shop where title = #{title,jdbcType=VARCHAR} and poi_id = #{poiId,jdbcType=INTEGER}")
    ShopBean selectByOnly(ShopBean shopBean);

    /**
     *
     * @param status 除了该状态的数量
     * @return
     */
    @Select("select count(id) from shop where status <> #{status,jdbcType=INTEGER}")
    Integer countsExceptStatus(@Param("status") Integer status);


    List<ShopBean> selectByPageAndExceptStatus(@Param("start") Integer start,@Param("size") Integer size,@Param("status") Integer status);


    //查找有门店的shop
    List<ShopBean> findHasBranch();

    Integer saveShopBranch(ShopBean shopBean);

    //根据状态获取信息
    List<ShopBean> findShopByStatus(@Param("status") Integer status,@Param("start")Integer start,@Param("size")Integer size);

}